import {
    fetchDelete,
    get,
    post,
    put
} from "@/api/request";


export const changeVideoNum = (params, errorMessage) => {
    return put(`/kc/course/video/chapter/change-video-count`, params, errorMessage);
};

export const fetchClassesAll = (params, errorMessage) => {
    return get(`/course/classes/list`, params, errorMessage);
};

export const fetchSemesterAll = (params, errorMessage) => {
    return get(`/course/semester/list`, params, errorMessage);
};
export const fetchCategoryFirstStage = (params, errorMessage) => {
    return get(`/course/category/getFirstStage`, params, errorMessage);
};

export const fetchResourcesAll = (params, errorMessage) => {
    return get("/course/resource/ordinary_page_list", params, errorMessage);
};

export const fetchCategoryChildren = (params, errorMessage) => {
    return get(`/course/category/getChildren`, params, errorMessage);
};

export const fetchClassificationFirst = (params, errorMessage) => {
    return get(`/course/classification/getFirstStage`, params, errorMessage);
};

export const fetchClassificationList2 = (params, errorMessage) => {
    return get(`/course/classification/list`, params, errorMessage);
};
export const updateClassificationSort = (params, errorMessage) => {
    return put(`/course/classification/update`, params, errorMessage);
};
export const fetchCourseList = (params, errorMessage) => {
    return get(`/course/base/list`, params, errorMessage);
};
export const fetchChapterList = (params, errorMessage) => {
    return get(`/course/chapter/list`, params, errorMessage);
};

export const fetchClassificationChildren = (params, errorMessage) => {
    return get(`/course/classification/getChildren`, params, errorMessage);
};

export const postCourseBaseInfo = (params, errorMessage) => {
    return post(`/course/base/update`, params, errorMessage);
};

export const postCourseCreditInfo = (params, errorMessage) => {
    return post(`/course/credit/update`, params, errorMessage);
};

export const postCourseChargeInfo = (params, errorMessage) => {
    return post(`/course/charge/update`, params, errorMessage);
};

export const getCourseChapters = (params, errorMessage) => {
    return get(`/course/chapter/getChapter`, params, errorMessage);
};
export const getAllClassification = (params, errorMessage) => {
    return get(`/course/classification/getClassification`, params, errorMessage);
};

export const getChapterResource = (params, errorMessage) => {
    return get(`/course/resource/re/list`, params, errorMessage);
};

export const getCourseQuestion = (params, errorMessage) => {
    return get(`/course/question/re/list`, params, errorMessage);
};

export const postCourseChapters = (params, errorMessage) => {
    return post(`/course/chapter/update`, params, errorMessage);
};
export const publishChapterAndResource = (params, errorMessage) => {
    return put(`/course/chapter/publishChapterAndResource`, params, errorMessage);
};

export const postCourseChaptersResource = (params, errorMessage) => {
    return post(`/course/resource/re/edit-add`, params, errorMessage);
};
export const updateCourseChaptersResource = (params, errorMessage) => {
    return put(`/course/resource/re/update`, params, errorMessage);
};
export const postCourseQuestionResource = (params, errorMessage) => {
    return post(`/course/question/re/edit/add`, params, errorMessage);
};

export const putCourseChapters = (params, errorMessage) => {
    return put(`/course/chapter/update`, params, errorMessage);
};

export const deleteCourseChapters = (params, errorMessage) => {
    return fetchDelete(`/course/chapter/delete`, params, errorMessage);
};

export const fetchCategoryList = (params, errorMessage) => {
    return get("/course/category/list", params, errorMessage);
};

export const fetchPlatformList = (params, errorMessage) => {
    return get("/user/sys/platform/list", params, errorMessage);
};

//

export const getVideoInfos = (params, errorMessage) => {
    return get(`/course/resources/record/get-video-infos`, params, errorMessage);
};
export const getVideoInfo = (params, errorMessage) => {
    return get(`/course/resources/record/get-video-info`, params, errorMessage);
};

export const getPlayInfo = (params, errorMessage) => {
    return get(`/course/resources/record/get-play-info-resource-id`, params, errorMessage);
};
export const fetchClassificationList = (params, errorMessage) => {
    return get("/user/cu/admin/classification/list", params, errorMessage);
};
export const batchResourcesUpload = (params, errorMessage) => {
    return post("/course/resources/batch-upload", params, errorMessage);
};
export const fetchResourcesGroupFirst = (params, errorMessage) => {
    return get(`/course/resources/group/getFirstStage`, params, errorMessage);
};
export const fetchResourcesGroupChildren = (params, errorMessage) => {
    return get(`/course/resources/group/getChildren`, params, errorMessage);
};
export const fetchResourcesByGroupId = (params, errorMessage) => {
    return get(`/course/resources/record/list`, params, errorMessage);
};
export const fetchResourcesByGroupId2 = (params, errorMessage) => {
    return get(`/course/resources/record/deploy-list`, params, errorMessage);
};
export const fetchOrdinaryResourcesList = (params, errorMessage) => {
    return get(`/course/resources/list`, params, errorMessage);
};
export const fetchLiveResourcesList = (params, errorMessage) => {
    return get(`/course/resources/live/list`, params, errorMessage);
};
export const fetchResourcesById = (params, errorMessage) => {
    return get(`/course/resources/record/detail/${params.id}`, params, errorMessage);
};
export const fetchResourcesByIds = (params, errorMessage) => {
    return post(`/course/resources/record/details`, params, errorMessage);
};
export const fetchLiveResourcesById = (params, errorMessage) => {
    return get(`/course/resources/live/detail/${params.id}`, params, errorMessage);
};
export const fetchOrdinaryResourcesById = (params, errorMessage) => {
    return get(`/course/resources/detail/${params.id}`, params, errorMessage);
};
export const fetchOrdinaryResourcesByIds = (params, errorMessage) => {
    return post(`/course/resources/details`, params, errorMessage);
};

export const updateStatus = (params, errorMessage) => {
    return put(`/course/base/update-status`, params, errorMessage);
};

export const addTeacherToCourse = (params, errorMessage) => {
    return post(`/course/teacher/re/add-course-teacher`, params, errorMessage);
};

export const updateTeacherType = (params, errorMessage) => {
    return put(`/course/teacher/re/update-teacher-type`, params, errorMessage);
};
export const fetchSource = (params, errorParams) => {
    return get("/course/resource/re/resource-all", params, errorParams);
};
export const getLazyChildren = (params, errorParams) => {
    return get("/course/resource/group/getLazyChildren", params, errorParams);
};
export const getArticleLazyChildren = (params, errorParams) => {
    return get("/course/article/column/getLazyChildren", params, errorParams);
}
export const fetchArticleColumnFirst = (params, errorMessage) => {
    return get(`/course/article/column/getFirstStage`, params, errorMessage);
};
export const fetchArticleColumnChildren = (params, errorMessage) => {
    return get(`/course/article/column/getChildren`, params, errorMessage);
};
export const endSemester = (params, errorMessage) => {
    return put(`/course/semester/end`, params, errorMessage);
};
export const endSemesters = (params, errorMessage) => {
    return put(`/course/semester/end-list`, params, errorMessage);
};
export const getChatSensitiveWordStatus = (params, errorMessage) => {
    return get(`/course/chat/word/status`, params, errorMessage);
};
export const updateSensitiveWordStatus = (params, errorMessage) => {
    return put(`/course/chat/word/status`, params, errorMessage);
};
// 课程权重
export const getCourseWeight = (params, errMsg) =>{
    return get("/course/Weight/get-course-weight", params, errMsg);
}
// 学生成绩信息
export const studentAchievement = (params, errMsg) => {
    return get(
        "/course/course/achievement/student-achievement",
        params,
        errMsg
    );
}
export const studentResourceWatchList = (params, errMsg) =>{
    return get(
        "/course/course/achievement/resource-watch-list",
        params,
        errMsg
    );
}

// 学生端-平时成绩-测试成绩
export const testAchievement = (params, errMsg) => {
    return get(
        "/course/course/achievement/test-achievement",
        params,
        {
            ignoreFalse: true,
            ...(errMsg || {}),
        },
    );
}

export const updateTeacherDiscount = (params, errorMessage) => {
    return put(`/course/teacher/re/updateDiscount`, params, errorMessage);
};
export const getTeacherDiscountCourseList = (params, errorMessage) => {
    return get(`/course/teacher/re/teacher-course-page`, params, errorMessage);
};
export const updateChannelDiscount = (params, errorMessage) => {
    return put(`/course/channel/re/update`, params, errorMessage);
};
export const addChannelDiscount = (params, errorMessage) => {
    return post(`/course/channel/re/update`, params, errorMessage);
};
export const deleteChannelDiscount = (params, errorMessage) => {
    return fetchDelete(`/course/channel/re/delete`, params, errorMessage);
};
